fix(accounts): return to Accounts screen from flows started outside it - #641
Conversation
returnToAccountsScreen popped until it found the Accounts route. Flows started from Settings > Add account (create multisig, create account, import wallet) have no Accounts route in the stack, so popUntil emptied the Navigator and left a black screen. Pop to the Accounts route when it is in the stack, otherwise pop to the root and push a fresh Accounts screen. The highlight for the new account is passed to that fresh screen directly, since the open-accounts intent listener only fires on an already-mounted screen.
n13
left a comment
There was a problem hiding this comment.
Reviewer model: GPT-6 Astra
Verdict (advisory): Approve
Reviewed 1a16a50c112291c4096f42cd02465341cb84e968 against base 0b7d2033e515e9f2ec1c52152052ea000ef6b78c in a detached worktree. No blocking findings.
The root-route guard prevents Settings-originated add/import flows from emptying the Navigator. Returning to an existing Accounts route retains its state and sends the highlight intent; opening a fresh route passes the highlight through the constructor before its first build. All callers of the relocated helper resolve correctly. I also traced account creation, wallet import/naming, multisig creation, hardware-account completion, and disconnect callers.
Validation:
flutter test --no-pub --reporter expanded test/screens/home_intent_gating_test.dart test/unit/accounts_grouping_test.dart: all 15 tests passed.dart run melos exec -- dart format lib test --line-length=120 --output=none --set-exit-if-changed: passed across all four packages, with no changes.git diff --check: passed for the complete PR diff.- GitHub Analyze CI succeeded on the reviewed head.
- Local
dart run melos run analyzewas stopped at the required 10-second limit; it did not complete workspace analysis.
Non-blocking coverage improvement: add a widget regression for both Settings-originated and Accounts-originated completion, checking the resulting route stack, new-account highlight, and Back navigation. The existing focused tests compile the affected navigation chain but do not directly exercise this return helper; I did not perform an interactive device test.
1a16a50 to
105a56f
Compare
105a56f to
1617545
Compare
Problem
After creating a multisig from Settings → Add account → Create multisig, the app went black. The same happens for Create account and Import wallet started from Settings.
returnToAccountsScreenpops until it finds the Accounts route. From the Accounts screen that route is in the stack and it works. From Settings there is no Accounts route, sopopUntilpops every screen and leaves the Navigator empty ('_history.isNotEmpty': is not trueon hot reload).Fix
returnToAccountsScreenpops to the Accounts route when present, otherwise to the root, and then pushes a fresh Accounts screen.openAccountsIntentProviderlistener only fires on an already mounted screen, so it stays the mechanism for the pop-back case.openAccountsScreenmoved intoaccounts_navigation.dartso the navigation helpers live together without a circular import.Also bumps the AGENTS.md analyzer rule to 10 seconds: the analysis server hangs on this machine, tests are the compile check.
Test
flutter test test/screens/home_intent_gating_test.dartcompiles the home + accounts chain and passes.